<!--
 * @Descripttion: 
 * @version: 
 * @Author: Jun
 * @Date: 2021-06-16 15:30:37
 * @LastEditors: Jun
 * @LastEditTime: 2021-06-17 16:58:00
-->
<template>
  <!-- 搜索框 -->
  <search></search>

  <!-- 轮播图 -->
  <swiper data="123"></swiper>

  <!-- 底部导航条 -->
  <tab-bar></tab-bar>
</template>

<script lang="ts">
import tabBar from "@components/tabBar.vue";
import search from "./components/search.vue";
import swiper from "./components/swiper.vue";

import {
  getCurrentInstance,
  onErrorCaptured,
  onMounted,
  reactive,
  toRefs,
} from "@vue/runtime-core";
import { getIndexInfo } from "@apis/home";
export default {
  components: {
    tabBar,
    search,
    swiper,
  },
  setup() {
    let { proxy }:any = getCurrentInstance();

    let state = reactive({
      data: [],
    });

    const API_getIndexInfo = async () => {
      return await proxy.$httpRequest({
        url: getIndexInfo,
      });
    };

    onMounted(async () => {
      let res = await API_getIndexInfo();
      state.data = res.data.data;
      console.log("🚀 ~ file: home.vue ~ line 55 ~ onMounted ~ res.data.data", res.data.data)
    });
    
    return {
      ...toRefs(state),
    };
  },
};
</script>

<style>
</style>